@extends('admin.base')
	@section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            公告信息列表
            <small>mall forums of simple table</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="{{url('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">友情链接信息</a></li>
            <li class="active">列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
			<div class="row">
				<div class="col-md-12">
					<div class="box">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-th"></i> 公告信息管理 </h3>
						</div><!-- /.box-header -->
						<div class="box-body">
							<table class="table table-bordered">
								<tr>
								  <th>公告ID</th>
								  <th>公告标题</th>
								  <th>公告内容</th>
								  <th>公告时间</th>
								  <th>显示区域</th>
								  <th>公告管理</th>
								</tr>
								@foreach($list as $link)
								<tr>
								  <td>{{$link->id}}</td>
								  <td>
									@if($link->title=='0')
										公告
									@elseif($link->title=='1')
										喜讯
									@else
										促销
									@endif
								  </td>
								  <td>{{$link->content}}</td>
								  <td>{{$link->time}}</td>
								  <td>{{$link->status=='0'?'主体区':'轮播区'}}</td>
								  <td>
								  <button onclick="doDel({{$link->id}});" class="btn btn-xs btn-danger">删除</button> 
								  <a href='{{url("admin/notice/$link->id/edit")}}' class="btn btn-xs btn-primary">编辑</a></td>
								</tr>
								@endforeach
							</table>
							<form id="mydeleteform" method="post">
								<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
								<input type="hidden" name="_method" value="DELETE">
							</form>
						</div><!-- /.box-body -->
						<div class="box-footer clearfix">
						  {!! $list->render() !!}
						</div>
					</div><!-- /.box -->
				</div><!-- /.col -->
			</div><!-- /.row -->
		</section><!-- /.content -->
	@endsection
	
	@section("myscript")
	<script type="text/javascript">
		function doDel($id){
			if(confirm('确定要删除？')){
				$("#mydeleteform").attr("action","{{url('admin/notice')}}/"+$id).submit();
			}
		}
	</script>
	@endsection